package com.example.enginsdk;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatDialogFragment;
import android.view.View;
import android.widget.TextView;

import org.w3c.dom.Text;

public class MainActivity extends AppCompatActivity {

    TextView openTv;
    TextView chooseTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        openTv = findViewById(R.id.openInputMethod);
        chooseTv = findViewById(R.id.chooseInputMethod);

        openTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AppUtils.startChooseInput(MainActivity.this);
            }
        });
        chooseTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AppUtils.startSetDefaultInput(MainActivity.this);
            }
        });
    }

    @Override
    protected void onResume() {
        super.onResume();
        boolean isCheck = AppUtils.checkHasCheck(this);
        boolean isDefault = AppUtils.checkIsDefault(this);

        openTv.setEnabled(!isCheck);
        chooseTv.setEnabled(!isDefault);
    }
}